<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/12/6
 * Time: 17:55
 */

namespace app\storage\model;


use think\Model;

class RoleUserModel extends Model
{
    protected $table = 'cmf_role_user';

    public function Role(){
        return $this->belongsTo('RoleModel','role_id','id')->bind(['parent_id','role_name'=>'name']);//字段别名在左
    }

    public function User(){
        return $this->belongsTo('UserModel','id','user_id')->bind('role_id,parent_id');
    }
}